Author: Steve Harrison (steve3000)
System: Acorn Archimedes Arthur 1.2/RISC OS 2/RISC OS 3 (but also works directly on modern RISC OS 5)
Language: ARM code (ARMv2 target, no Thumb code)
Length of assembler source code: 1500 bytes
Length of executable: 66 bytes
 - Length of executed code: 52 bytes (13 x 32 bit ARM instructions)
 - Length of data table: 14 bytes

Description of how it works:

ARM instructions are fixed size of 4 bytes (32 bits) so it is critial to minimise number of instructions. This code uses three loops, starting with a main loop to read each byte of 14 rows data from a decrementing pointer to the end of file. It then calculates the number of spaces to centre (based on standard RISC OS 60-character width desktop text box) and outputs using a second loop, followed by outputting the required number of stars in the final loop and triggering a new line before looping back to the start. The source code is commented for more details. Space saving achieved by the exit test in main loop triggered when a data byte >=30 is read, this happens after the 14th row, when code is read as the next byte after row 14.

To use on an Archimedes emulator, e.g. Arculator, load the disc image "ARMTree disc.adf", open the disc on the desktop and double-click on "ARMTree" or type "*Run ARMTree". To use on RISC OS 5 on a Raspberry Pi, take the file "ARMTree,ff8" onto the Raspberry Pi, set the filetype to "Absolute", then double-click to run.

Files in ZIP:

ARMTree disc.adf           - Archimedes disc image containing ARMTree executable
ARMTree image.png          - Image of the code run on a RISC OS 3 Archimedes
ARMTree source listing.png - Image of the code listed on a RISC OS 3 Archimedes
ARMTree text source.txt    - Windows Notepad file listing the ARM assembler source
ARMTree,ff8                - 66 byte RISC OS ARM code executable
Info and description.txt   - This file
SrcARMTree,ffb             - RISC OS assembler source